package com.pitaya.avatar.service.impl;

import com.pitaya.avatar.service.IClusterNode;

public class Node {
	
	private Node parentNode = null;
	private int childrenSize;
	
	private IClusterNode clusternode;
	
	public Node() {
		
	}
	
	public Node(IClusterNode node){
		this.clusternode = node;
		childrenSize = 1;
	}
	
	public String getNodeName(){
		return this.clusternode.getNodeId();
	}
	
	public double getXValue(){
		return this.clusternode.getXAxis();
	}
	
	public double getYValue(){
		return this.clusternode.getYAxis();
	}
	
	public int getChildsSize(){
		return this.childrenSize;
	}
	
	public void setChildsSize(int size){
		this.childrenSize  = size;
	}
	
	public void setParent(Node p){
		this.parentNode = p;
	} 
	
	public Node getParent(){
		return parentNode;
	}
	
	public IClusterNode getClusterNode(){
		return this.clusternode;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(this == obj)
			return true;
		if(obj != null && obj instanceof Node){
			if(((Node)obj).getNodeName().equals(this.getNodeName()))
				return true;
		}
		return false;
	}
	
	@Override
	public int hashCode() { 
		return this.getNodeName().hashCode();
	}
	
}
